package com.mobilg.dating;


import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import com.mobilg.client.request.RequestMethod;
import com.mobilg.client.request.RestClient;
import com.mobilg.dating.R;

public class RestClientActivity extends Activity{
		
	private String LOGIN_URL = "http://10.0.2.2:8080/AVMCepteServer/xml/624ecc2e855a266c1354f32b0addabb46d85fd7e/listShop";
	
	private Button mUploadButton;
	private TextView mText;
	

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main_new);
		
		mUploadButton = (Button) findViewById(R.id.Request_btn);
		mText = (TextView) findViewById(R.id.request_txt);
		mUploadButton.setVisibility(View.VISIBLE);
		
		mUploadButton.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				RestClient client = new RestClient(LOGIN_URL);
				
				try {
				    client.Execute(RequestMethod.GET);
				} catch (Exception e) {
				    e.printStackTrace();
				}				 
				String response = client.getResponse();
				
				mText.setText("Api Call Response From Server:"+response);

			}
		});
		
	}
}
